  import payChannelApi from '@/api/declaration/pay/payChannelApi'

import httpRequest from '@/config/axios/httpRequest'
import { ChannelModel } from '@/models/pay/ChannelModel'

// 查询列表支付渠道
export const getChannelPage = (params: PageParam) => {
  return httpRequest.get(payChannelApi.GetChannelPage, {params})
}

// 查询详情支付渠道
export const getChannel = (appId: string, code: string) => {
  const params = {
    appId: appId,
    code: code
  }
  return httpRequest.get(payChannelApi.GetChannel, { params })
}

// 新增支付渠道
export const createChannel = (data: ChannelModel) => {
  return httpRequest.post(payChannelApi.CreateChannel, data)
}

// 修改支付渠道
export const updateChannel = (data: ChannelModel) => {
  return httpRequest.put(payChannelApi.UpdateChannel, data)
}

// 删除支付渠道
export const deleteChannel = (id: number) => {
  return httpRequest.delete(payChannelApi.DeleteChannel, { params: { id } })
}

// 导出支付渠道
export const exportChannel = (params) => {
  return httpRequest.download(payChannelApi.ExportChannel, params)
}
